#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/11/13 9:54
# @Author  : cfg
# @File    : jar_name_utils.py
# @Software: PyCharm
def get_artifact_id(jar_name: str) -> str:
    if not jar_name.__contains__("-"):
        return jar_name.split(".")[0]
    spilt_idx = jar_name.rfind("-")
    return jar_name[:spilt_idx]


def get_version(jar_name: str) -> str:
    split1_idx = jar_name.rfind("-")
    split2_idx = jar_name.rfind(".")
    return jar_name[split1_idx+1:split2_idx]


def get_group_id() -> str:
    return "jar-installer"


if __name__ == '__main__':
    print(get_artifact_id("docker-java-transport-httpclient5-3.2.13.jar"))
    print(get_version("docker-java-transport-httpclient5-3.2.13.jar"))